package com.skivingcloud.admin.sys.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

import java.io.Serial;
import java.io.Serializable;
import java.util.StringJoiner;

/**
 *  实体类。
 *
 * @author skivingcloud
 * @since 2023-08-28
 */
@Table(value = "sys_dictionary")
@Schema(name = "SysDictionary对象", title = "数据字典")
public class SysDictionary implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    @Id
    @Schema(title = "主键")
    private String id;
    
    @NotBlank(message = "字典类型编码不能为空")
    @Size(max = 50, message = "字典类型编码长度不能超过50")
    @Schema(title = "字典类型编码")
    private String classCode;
    
    @NotBlank(message = "字典类型名称不能为空")
    @Size(max = 50, message = "字典类型名称长度不能超过50")
    @Schema(title = "字典类型名称")
    private String className;
    
    @NotBlank(message = "字典值编码不能为空")
    @Size(max = 50, message = "字典值编码长度不能超过50")
    @Schema(title = "字典值编码")
    private String dataCode;
    
    @NotBlank(message = "字典名称不能为空")
    @Size(max = 100, message = "字典名称 长度不能超过100")
    @Schema(title = "字典名称")
    private String dataName;
    
    @Min(value = 0, message = "排序不能小于0")
    @Max(value = 99999, message = "排序不能大于99999")
    @Schema(title = "排序")
    private Integer dataOrder;
    
    @Schema(title = "备注")
    private String remark;
    
    @NotBlank(message = "状态不能为空")
    @Schema(title = "状态")
    private String state;

    /**
     * 上级id
     */
    @Schema(title = "上级id")
    private String parentId;
    
    @Column(ignore = true)
    private String parentName;
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getClassCode() {
        return classCode;
    }

    public void setClassCode(String classCode) {
        this.classCode = classCode;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getDataCode() {
        return dataCode;
    }

    public void setDataCode(String dataCode) {
        this.dataCode = dataCode;
    }

    public String getDataName() {
        return dataName;
    }

    public void setDataName(String dataName) {
        this.dataName = dataName;
    }

    public Integer getDataOrder() {
        return dataOrder;
    }

    public void setDataOrder(Integer dataOrder) {
        this.dataOrder = dataOrder;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
    
    public String getParentName(){
        return parentName;
    }
    
    public void setParentName(String parentName){
        this.parentName = parentName;
    }
    
    @Override
    public String toString(){
        return new StringJoiner(", ", SysDictionary.class.getSimpleName() + "[", "]")
                .add("id='" + id + "'")
                .add("classCode='" + classCode + "'")
                .add("className='" + className + "'")
                .add("dataCode='" + dataCode + "'")
                .add("dataName='" + dataName + "'")
                .add("dataOrder=" + dataOrder)
                .add("remark='" + remark + "'")
                .add("state='" + state + "'")
                .add("parentId='" + parentId + "'")
                .add("parentName='" + parentName + "'")
                .toString();
    }
}
